<select id="{{statementName}}" parameterType="map" resultMap="{{resultMap}}">
    SELECT * FROM {{collection.targetTable}} LEFT OUTER JOIN {{collection.joinTable.tableName}} ON
    {{#collection.joinTable.inverseJoinColumns}}
        {{^-first}} AND {{/-first}}
        {{collection.joinTable.tableName}}.{{name}} = {{collection.targetTable}}.{{referencedColumnName}}
    {{/collection.joinTable.inverseJoinColumns}}
    WHERE
    {{#collection.joinTable.joinColumns}}
        {{^-first}} AND {{/-first}}
        {{collection.joinTable.tableName}}.{{name}} = #{ {{referencedColumnName}} }
    {{/collection.joinTable.joinColumns}}
    {{#collection.orderBy}}
        ORDER BY {{collection.order}}
    {{/collection.orderBy}}
</select>
